package com.qb.ems;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Types;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Test {
    public static void main(String[] args) throws Exception {

        String url = "jdbc:gbasedbt-sqli://192.168.0.101:23513/testsp520:GBASEDBTSERVER=gbaseserver3513;delimident=n;" +
                "sqlmode=oracle;PROTOCOLTRACE=5;PROTOCOLTRACEFILE=./trace3.log;DB_LOCALE=zh_CN.utf8;CLIENT_LOCALE=zh_CN.utf8;IFX_LOCK_MODE_WAIT=60;";
        //Types.BOOLEAN;
       Class.forName("com.gbasedbt.jdbc.Driver");
        Connection conn = DriverManager.getConnection(url,"gbasedbt","GBase8s");
//        conn.getMetaData().getIndexInfo(null,"testsp520","test",false,false);
//        conn.getMetaData().getPrimaryKeys(null,"testsp520","test");
        String tbs = "test";
        ResultSet rs = conn.getMetaData().getColumns(null,"testsp520",tbs,null);
        Pattern pattern = Pattern.compile("jdbc:gbasedbt-sqli://([\\w\\-\\.]+):?([0-9]*)/([\\w\\-]+)", Pattern.CASE_INSENSITIVE);
        Matcher matcher =  pattern.matcher(url);
        matcher.find();
        String ax = matcher.group(1);
        System.out.println(ax);
        ax = matcher.group(2);
        System.out.println(ax);

       int a = matcher.groupCount();
       System.out.println(a);
    }
    public static short getShort(String s) {
        return (short)get(s);
    }

    public static Object get(String s){
        return s;
    }
}
